//package com.clickhouse_test.app.config;
//
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.SqlSessionTemplate;
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.boot.jdbc.DataSourceBuilder;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import javax.sql.DataSource;
//
//@Configuration
//@MapperScan(basePackages = "com.clickhouse_test.app.mapper.mysql", sqlSessionFactoryRef = "MysqlSqlSessionFactory")
//public class Datasource_MysqlConfig {
//    @Bean(name = "MysqlDatasource")
//    @ConfigurationProperties(prefix = "spring.datasource.mysql")
//    public DataSource getMysqlDatasource() {
//        return DataSourceBuilder.create().build();
//    }
//
//    @Bean(name = "MysqlSqlSessionFactory")
//    public SqlSessionFactory MysqlSqlSessionFactory(@Qualifier("MysqlDatasource") DataSource dataSource) throws Exception {
//        SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
//        bean.setDataSource(dataSource);
//        //bean.setMapperLocations( new PathMatchingResourcePatternResolver().getResources("classpath*:mapping/learn/*.xml"));
//        return bean.getObject();
//    }
//
//    @Bean("MysqlSqlSessionTemplate")
//    public SqlSessionTemplate MysqlSqlSessionTemplate(@Qualifier("MysqlSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
//        return new SqlSessionTemplate(sqlSessionFactory);
//    }
//}
